<?php 
    use_helper('Date');
    $moduleName = sfContext::getInstance()->getRequest()->getParameter("module");
    $actionName = sfContext::getInstance()->getRequest()->getParameter("action");
?>
<div class="content">
    <div id="sf_admin_container">
        <h1>statistics chart</h1>

        <div id="sf_admin_content">

            <div class="sf_admin_form">
                <form method="post" action="" enctype="multipart/form-data">
                    <div class="ui-tabs ui-widget ui-widget-content ui-corner-all">

                        <div >
                            <div class="sf_admin_form_row">
                                <?php
                                $date = new DateTime();
                                $endDate = $date->format('Y-m-d');
                                $startDate = $date->sub(new DateInterval('P0Y3M0DT0H0M0S'))->format('Y-m-d');

                                $years = range(date('Y')-10, date('Y'));
                                $w = new sfWidgetFormDateRange(array(
                                                'from_date' => new sfWidgetFormDate(array(
                                                        "format" => "%year%年%month%月%day%日",
                                                        "years" => array_combine($years, $years)
                                                        )),
                                                'to_date' => new sfWidgetFormDate(array(
                                                        "format" => "%year%年%month%月%day%日",
                                                        "years" => array_combine($years, $years)
                                                        )),
                                                 'template'  => 'start: %from_date% end: %to_date%'
                                    ));
                                echo $w->render("produce_stats_chart", array('from'=>$startDate, 'to'=>$endDate));

                                echo "&nbsp;&nbsp; <input type='button' name='btn_produce_stats_chart' id='btn_produce_stats_chart' value='Go!'>";

                                ?>
                            </div>

                            <div class="sf_admin_form_row" id="produce_stats_chart">
                            </div>

                        </div>

                    </div>
                </form>
            </div>
        </div>

    </div>
</div>
<?php
   echo "<script type=\"text/javascript\" src=\"/js/apps/backend/{$moduleName}/".$actionName.".js\"></script>\n";
?>
